package com.waitingresult.security.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * All right reserved,Designed By WangShuai
 * <p>
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : PasswordUtils
 * @Description :
 * @date : 2021/9/12 17:05
 */
public class PasswordUtils {

    public PasswordUtils() {
    }

    public static PasswordEncoder getEncoder() {
        return new BCryptPasswordEncoder();
    }

    public static String encode(String password) {
        return getEncoder().encode(password);
    }

    public static boolean match(String rowPassword, String password) {
        return getEncoder().matches(rowPassword, password);
    }
}
